<?php 
session_start();
include APPPATH.'libraries/khlang.php';
function gencol($c){
    $c=  str_replace("`", "",$c[0]);
            return "`".md5("k$c")."`";
            //return "`$c"."_".md5("k$c")."`";
        }
class home extends CI_Controller  {

        /**
        * Index Page for this controller.
        *
        * Maps to the following URL
        * 		http://example.com/index.php/welcome
        *	- or -  
        * 		http://example.com/index.php/welcome/index
        *	- or -
        * Since this controller is set as the default controller in 
        * config/routes.php, it's displayed at http://example.com/
        *
        * So any other public methods not prefixed with an underscore will
        * map to /index.php/welcome/<method_name>
        * @see http://codeigniter.com/user_guide/general/urls.html
        */
       private $_configs = null;
       function __construct()
        {
            parent::__construct();
            $this->load->helper('url');
            $this->load->library('smarty3','','smarty');
            $_SESSION["LANG"]="VI";
            include APPPATH . 'libraries/defu.php';
        }
        public function index(){
	
//            $t= "<textarea class='w100pc' style='position: absolute;top: 0;left: 0;bottom: 0;right: 10px;'>
//CREATE TABLE `tbl_user` (
//  `Server` varchar(255) DEFAULT NULL,
//  `UserName` varchar(255) DEFAULT NULL,
//  `Charactor` varchar(255) DEFAULT NULL,
//  `Level` int(11) DEFAULT NULL,
//  `IP` varchar(255) DEFAULT NULL,
//  `Date` datetime DEFAULT NULL,
//  `ID` int(11) NOT NULL AUTO_INCREMENT,
//  PRIMARY KEY (`ID`)
//) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
//
//-- ----------------------------
//-- Records of tbl_tour
//-- ----------------------------
//
//            </textarea>
//            ";
//            echo preg_replace_callback("/`(\w+)`/", 'gencol', $t);
//            return;
            global $lang;
            if(isset($_SESSION["ADP"]["USER"])){
                redirect(base_url("admin-planners/authority/MyAuthority"));
            }else{
                redirect(base_url("OAuth"));
                //$this->smarty->display("admin-planners/01_login");
            }
	}
        
        function login(){
            $this->load->model('admin-planners/account_model','account_model');
            $account=$this->account_model->login(2,1);
            $authority=  preg_split("~;~", ";admin;", -1, PREG_SPLIT_NO_EMPTY);
            $authority=$this->account_model->getAuthoritys($authority);
            print_r($authority);
            $this->smarty->display("admin-planners/01_login");
        }
        
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */